﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;
using System.Resources;

namespace IDE_week2_Forms_project
{
    public partial class Form1 : Form
    {

        Form newWindow;
        ResourceManager LocRM;
        string lang;

        public Form1()
        {
            lang = "pt-BR";
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); 
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang); 
            LocRM = new ResourceManager("IDE_week2_Forms_project.Form1", typeof(Form1).Assembly);
            InitializeComponent();
            newWindow = new Form2();
            newWindow.Icon = Properties.Resources.ICON2;
        }

        private void ChangeLanguage(string lang)
        {
            foreach (Control c in this.Controls)
            {
                ComponentResourceManager resources = new ComponentResourceManager(typeof(Form1));
                resources.ApplyResources(c, c.Name, new CultureInfo(lang)); 
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            newWindow.Visible = true;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Icon = Properties.Resources.ICON1;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Icon = default(Icon);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (lang == "pt-BR")
                lang = "en-US";
            else
                lang = "pt-BR";

            ChangeLanguage(lang);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            int[] numbers = new int[10];

            Class1.MakeRandomNumber(numbers);

            label1.Text = numbers[0] + ", " + numbers[1] + ", " + numbers[2];
        }
    }
}
